<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }
        
        div {
            height: 30px;
            width: 100%;
        }
        
        .div {
            background-color: chartreuse;
        }
        
        .box {
            height: 1600px;
            padding-top: 400px;
        }
        
        .top {
            background-color: coral;
            position: sticky;
            top: 0;
        }
    </style>
</head>

<body>
    <div class="div">

    </div>
    <div class="box">
        <div class="top">
        </div>
    </div>

</body>

</html>